#include <iostream>
#include <vector>
#include "Thread.hpp"
#include<unistd.h>


const int thread_cnt = 5;

int test_cnt = 0;
void TestFunc()
{
    while (true)
    {
        //sleep(1);
        test_cnt++;
        std::cout << "test_cnt 被 执行" << " test_cnt= " << test_cnt << std::endl;
        if(test_cnt >= 1000)
        {
            break;
        }
        //sleep(1);
    }
}
int main()
{
    std::vector<ThreadModule::Thread> threads;

    for (int i = 0; i < thread_cnt; i++)
    {
        threads.emplace_back(TestFunc);
    }

    for(auto& thread : threads)
    {
        thread.Start();
    }

    //sleep(2);

    for(auto& thread : threads)
    {
        thread.Join();
    }
}